require(["../../conf/config.js"],function(){
	require(["jquery","jquery-cookie"],function($,jqcookie){
		console.log("success");	
			let allstr = getCookie("userlist");
			let allc = JSON.parse(allstr);
			$("#dl").click(function(){
				allc.forEach((item)=>{
					if($("dt input").val()==item.tel && $("dd input").val()==item.password){
						window.open("../index/index.html","_self");
						$("#danger").css({display:"none"})
						$("#cla1").css({display:"none"});
						item.status = 1;
					
					}else{
						$("#danger").css({display:"block"});
						item.status = 0;
					}	
				})
				setCookie("userlist",JSON.stringify(allc),30)				
			})
				
			// 原生封装
		function getCookie(key) {
			var kvlist = document.cookie.split("; ");
			var kv = kvlist.find(function(item) {
				return item.split("=")[0] == key;
			});
		
			if (kv) {
				return kv.split("=")[1];
			}
		}
		
		function getNDaysAfter(n) {
			var now = new Date();
			now.setDate(now.getDate() + n);
			return now;
		}
		
		function setCookie(key, val, days) {
			document.cookie = key + "=" + val + "; expires=" + getNDaysAfter(days) + "; path= /"
		}
		
	})
})